package com.ruoyi.quality.controller;

import java.util.List;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.quality.domain.TQualityFileItem;
import com.ruoyi.quality.domain.dto.TQualityPlanTaskDTO;
import com.ruoyi.quality.service.ITQualityPlanTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 计划任务明细Controller
 * 
 * @author mahl2
 * @date 2024-02-28
 */
@RestController
@RequestMapping("/quality/qualityPlanTaskProject")
public class TQualityPlanTaskController extends BaseController
{
    @Autowired
    ITQualityPlanTaskService iTQualityPlanTaskService;

    /**
     * 查询计划任务列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TQualityPlanTaskDTO tQualityPlanTaskDTO)
    {
        startPage();
        tQualityPlanTaskDTO.setUserName(SecurityUtils.getLoginUser().getUser().getUserName());
        List<TQualityPlanTaskDTO> list = iTQualityPlanTaskService.selectPlanTaskList(
                tQualityPlanTaskDTO);
        return getDataTable(list);
    }

    /**
     * 拆分质量问题文件
     */
    @PostMapping("/splitFile")
    public AjaxResult splitFile(@RequestBody List<TQualityFileItem> listFileItems)
    {
        return toAjax(iTQualityPlanTaskService.splitFile(listFileItems));
    }

}
